home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 6
/
CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso
/
cucd
/
readers
/
utils
/
gui4cli
/
g4c
/
various
/
trashcan.gc
< prev
next >
Wrap
Text File
|
1996-10-28
|
3KB
|
116 lines
G4C - Trash Can
; This GUI, a trash can, is not really a GUI but a couple of AppIcons
; pretending to be GUIs.
; When ever you shove files into the appicons by click dragging icons,
; these will be moved into a predefined assigned directory named
; TRASH_CAN:
; When Clicked upon an other gui will open (GUIs are cheap now-days..)
; called trashcan.g, which will allow you to delete some/all files.
; There is no close button. If you want it to quit, quit from trashcan.g
; The only reason this gui will not work correctly is if you move into
; the trashcan, an icon which has no acompanying file. The variable
; in this case will be "" (nothing) so the trashcan.g gui will open,
; thinking that the trashcan icon has been clicked upon..
;======================== Upon loading of the gui ======================
xOnLoad
ifexists assign TRASH_CAN ; see if trashcan has been assigned
;
else
setvar tc_can ""
ReqFile -1 -1 300 200 "Choose TRASH_CAN directory" DIR tc_can $$CURRENT_DIR
if $tc_can = ""
guiquit trashcan.gc
stop
else
run 'assign TRASH_CAN: $tc_can'
wait assign TRASH_CAN 200
if $$RETCODE > 0
guiquit trashcan.gc
stop
endif
endif
delvar tc_can
endif
guiload guis:G4C/Various/trashcan.g ; load the other gui
gosub trashcan.gc SetTrashIcon ; see at the end of this file
guiload guis:G4C/Rtn/routines.g
setvar tc_files ""
;-----> If something goes wrong
xOnFail
ezreq 'TRASH_CAN: \nError moving files.' OK ""
;=========================== The EMPTY trash can icon ==================
xAppIcon -1 -1 guis:info/TrashCanEmpty "" tc_files OFF
gadid 1
if $tc_files > " " ; If the user dragged files
setgad trashcan.gc 1 off
setgad trashcan.gc 2 on
gosub trashcan.gc TrashIn
else
guiopen trashcan.g ; If user just clicked on the icon...
endif
;========================== The FULL trashcan icon ======================
xAppIcon -1 -1 guis:info/TrashCanFull "" tc_files OFF
gadid 2
if $tc_files > " "
gosub trashcan.gc TrashIn
else
guiopen trashcan.g
endif
;========================== ROUTINES ====================================
;----------> Move files into the TRASHCAN
xROUTINE TrashIn
ifexists assign TRASH_CAN ; cause someone may have un-assigned it.
cutvar tc_files cut word 1 tc_kill ; get 1st file (there may be many)
while $tc_kill > " " ; start a loop
ifexists file $tc_kill ; move the file
action move $tc_kill TRASH_CAN:
else
ifexists dir $tc_kill ; or maybe it's a dir
action move $tc_kill TRASH_CAN:
endif
endif
joinfile $tc_kill .info tc_info ; move the icon too
ifexists file $tc_info
action move $tc_info TRASH_CAN:
endif
cutvar tc_files cut word 1 tc_kill ; get the next file
endwhile
else
EZReq "TRASH_CAN: assignment\nnot found!" "You don't say.." ""
endif
;----------> Set the correct AppIcon... look into the trashcan.g listview
xroutine SetTrashIcon
lvget trashcan.g 1 0 tc_a ; get the first of the list of files
if $tc_a > " " ; if there are files in the trashcan..
setgad trashcan.gc 1 off ; remove the full trashcan icon
setgad trashcan.gc 2 on ; show the empty icon
Else
setgad trashcan.gc 2 off
setgad trashcan.gc 1 on
endif
delvar tc_a ; no need to keep it around..